{{ partial "header.html" . }}

<h1>{{ .Title }}</h1>
<hr>

<div class="content">
{{ if not (eq (len $.Site.Taxonomies.tags) 0) }}
    {{ $fontUnit := "rem" }}
    {{ $largestFontSize := 5 }}
    {{ $smallestFontSize := 1.0 }}
    {{ $lineheight := (mul $largestFontSize 0.5)}}
    {{ $max := len (index $.Site.Taxonomies.tags.ByCount 0).Pages }}
    {{ $min := len (index $.Site.Taxonomies.tags.ByCount.Reverse 0).Pages }}

    <div id="tag-cloud" style="padding: 5px 15px;line-height:{{$lineheight}}{{$fontUnit}};">
        {{ range $name, $taxonomy := $.Site.Taxonomies.tags }}
            {{ $count := len $taxonomy.Pages }}
            {{ $weigth := div (sub (math.Log $count) (math.Log $min)) (sub (math.Log $max) (math.Log $min)) }}
            {{ $currentFontSize := (add $smallestFontSize (mul (sub $largestFontSize $smallestFontSize) $weigth) ) }}
            {{ $numFontSize := (mul $currentFontSize 0.7)}}
            <!--Current font size: {{$currentFontSize}}-->
            <a href="{{ "/tags/" | relLangURL }}{{ $name | urlize }}" style="font-size:{{$currentFontSize}}{{$fontUnit}};">{{ $name }}<span style="font-size:{{$numFontSize}}{{$fontUnit}};">&#40;{{ $taxonomy.Count }}&#41;</span></a>&thinsp;&thinsp;&thinsp;&thinsp;
        {{ end }}
    </div>
{{ end }}
</div>

{{ partial "footer.html" . }}